import pandas as pd
from pylab import *
mpl.rcParams['font.sans-serif'] = ['SimHei']
import matplotlib.pyplot as plt

def read():
    df = pd.read_excel("a.xlsx", usecols="A")
    df_li = df.values.tolist()
    result1 = []
    for s_li in df_li:
        result1.append(s_li[0])
    print(result1)

    df = pd.read_excel("a.xlsx", usecols="C")
    df_li = df.values.tolist()
    result2 = []
    for s_li in df_li:
        result2.append(s_li[0])
    print(result2)

    fig = plt.figure()  # 生成一个画板
    ax = fig.add_subplot(1, 1, 1)  # 定义有着1行1列子图的视图并取第一个


    x = list(range(len(result1)))


    # 手动添加线条数

    # 手动添加线条数
    ax.plot(x, result1, color='tab:blue', linestyle='-', label='实际温度',
            linewidth='1.5')  # 第一条曲线
    ax.plot(x, result2, color='tab:red', linestyle=':', label='补偿温度',
            linewidth='1.5')  # 第二条曲线


    # 定义坐标轴范围
    ax.set_xlim([0, 22])
    ax.set_ylim([30, 45])
    ax.set_xlabel('测量次数')
    # ax.set_xlabel('epoch')
    ax.set_ylabel('温度')
    ax.set_title('补偿温度曲线')
    ax.legend()

    fig.savefig("./xxa.png")
    fig.show()



if __name__ == '__main__':
    read()